package com.intramirror.product.service.impl;

import com.intramirror.product.entity.*;
import com.intramirror.product.mapper.PriceChangeRuleMapper;
import com.intramirror.product.mapper.SnapshotPriceDetailMapper;
import com.intramirror.product.mapper.SnapshotPriceRuleMapper;
import com.intramirror.product.service.IPriceChangeRuleService;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created on 2018/5/31.
 * @author 123
 */
@Service
public class PriceChangeRuleServiceImpl implements IPriceChangeRuleService {

    @Autowired
    PriceChangeRuleMapper priceChangeRuleMapper;

    @Autowired
    SnapshotPriceDetailMapper snapshotPriceDetailMapper;

    @Autowired
    SnapshotPriceRuleMapper snapshotPriceRuleMapper;

    @Override
    public List<Map<String, Object>> getProductRule(Map<String, Object> param) {
        return priceChangeRuleMapper.getProductRule(param);
    }

    @Override
    public List<Map<String, Object>> getProductGroupRule(Map<String, Object> param) {
        return priceChangeRuleMapper.getProductGroupRule(param);
    }

    @Override
    public List<Map<String, Object>> getProdCategoryBrandRule2(Map<String, Object> param) {
        return priceChangeRuleMapper.getProdCategoryBrandRule2(param);
    }

    @Override
    public List<Map<String, Object>> getProdCategoryBrandRule1(Map<String, Object> param) {
        return priceChangeRuleMapper.getProdCategoryBrandRule1(param);
    }

    @Override
    public List<Map<String, Object>> getProdCategoryBrandRule0(Map<String, Object> param) {
        return priceChangeRuleMapper.getProdCategoryBrandRule0(param);
    }

    @Override
    public List<Map<String, Object>> getCategoryType(Map<String, Object> param) {
        return priceChangeRuleMapper.getCategoryType(param);
    }

    @Override
    public String getSystemPropertyByName(String sysPropName){
        return priceChangeRuleMapper.getSystemPropertyByName(sysPropName);
    }

    @Override
    public Long isHotBrandProduct(Long productId){
        return priceChangeRuleMapper.isHotBrandProduct(productId);
    }

    @Override
    public void deleteSnapshotDetailByProductId(Map<String, Object> params){
        snapshotPriceDetailMapper.deleteSnapshotDetailByProductId(params);
    }

    @Override
    public List<SnapshotPriceRule> selectByPriceChangeRuleId(Long productId){
        return snapshotPriceRuleMapper.selectByPriceChangeRuleId(productId);
    }

    @Override
    public void insertSnapshotPriceDetail(SnapshotPriceDetail spd){
        snapshotPriceDetailMapper.insert(spd);
    }

    @Override
    public PriceChangeRule selectByPrimaryKey(Long priceChangeRuleId){
        return priceChangeRuleMapper.selectByPrimaryKey(priceChangeRuleId);
    }
}
